﻿<navigation:Page
    xmlns:Toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:src="clr-namespace:ibba.src.norisk"
    xmlns:slc="clr-namespace:ibba.src.slcomponentes;assembly=ibba.src.slcomponentes"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
    x:Class="ibba.src.norisk.PageGarantiaContrato"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    Background="#FF5C7590" 
    d:DesignWidth="800"
    d:DesignHeight="600"
    Title="Parametrização de Garantia por Contrato">

    <Grid x:Name="LayoutRoot" Background="#FFFFFFFF" Margin="0">
        <Toolkit:BusyIndicator x:Name="activity">
            <Grid x:Name="GridContent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid x:Name="gridCabecalho" Grid.Row="0" Background="#FF5C7590">
                    <!-- Pesquisa -->
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal" Grid.Column="0">
                        <Border CornerRadius="10" Background="#FFDEDEDE" MinWidth="100" Margin="5,5">
                            <TextBlock Text="Buscar" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                        </Border>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Grid.Column="1">
                        <StackPanel Orientation="Horizontal" Margin="10,0" Visibility="Collapsed">
                            <TextBlock Text="Cliente:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" Foreground="Yellow" />
                            <TextBox x:Name="txtCliente" HorizontalAlignment="Left" Margin="10,0" Width="160" VerticalAlignment="Center" TextWrapping="Wrap" Height="30" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Visibility="Collapsed">
                            <TextBlock Text="Grupo Econômico:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" Foreground="Yellow" />
                            <TextBox x:Name="txtGrupoEconomico" Margin="10,0" VerticalAlignment="Center" Width="160" TextWrapping="Wrap" Height="30"/>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Contrato:" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Verdana" Foreground="Yellow" />
                            <sdk:AutoCompleteBox x:Name="txtContrato" HorizontalAlignment="Left" Margin="10,0" Width="160" Height="30" VerticalAlignment="Center" KeyDown="txtContrato_KeyDown"/>
                            
                        </StackPanel>

                        <StackPanel Orientation="Horizontal">
                            <Button Name="btnPesquisar_" Click="btnPesquisar_Click" Height="28">
                                <StackPanel Orientation="Vertical">
                                    <Image Source="../image/search.png" Width="20" HorizontalAlignment="Left" Margin="5,1,0,7" />
                                    <TextBlock Text="Pesquisar" Margin="35,-25,8,0" FontSize="12"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>

                    </StackPanel>

                    <Image Source="../image/etq_confidencial_restrita.png" Width="160" Height="40" Grid.Column="2" Margin="2,0" />
                </Grid>

                <Grid x:Name="gridDetalhe" Grid.Row="1" Margin="7,8,7,0" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"/>
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock 
        	            Text="Parametrização de Garantia por Contrato"
        	            FontSize="14"
        	            Foreground="#FFC4991C"
        	            VerticalAlignment="Top" Width="Auto" 
        	            HorizontalAlignment="Left" FontFamily="Verdana" Grid.Row="0" Margin="8,2"/>

                    <Border CornerRadius="5" Background="#FFDEDEDE"  Margin="8,25,0,0" Grid.Row="0">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Contrato:" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                            <TextBlock Text="-" x:Name="txtContratoDet" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                            <TextBlock Text="Cliente:" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                            <TextBlock Text="-" x:Name="txtClienteDet" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                            <TextBlock Text="Grupo Econômico:" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                            <TextBlock Text="-" x:Name="txtGrupoEconomicoDet" Foreground="#FF14517B" Margin="10,0,0,0" VerticalAlignment="Center" />
                        </StackPanel>
                    </Border>

                    <data:DataGrid x:Name ="grdGarantiaContrato" Grid.Row="1"
        	            Margin="8,10,0,30" RenderTransformOrigin="0.5,0.5" 
        	            Visibility="Visible"
        	            MinHeight="200" AlternatingRowBackground="#FFFCFCFC" 
        	            RowBackground="#FFFCFCFC" 
        	            LoadingRow="grdGarantiaContrato_LoadingRow"  
        	            AutoGenerateColumns="False"
        	            BorderBrush="#FFF8F8F8" 
        	            HorizontalScrollBarVisibility="Hidden"
        	            ItemsSource="{Binding}" HorizontalAlignment="Left">
                        <data:DataGrid.Columns>
                            <data:DataGridTextColumn Header="Instrumento" Binding="{Binding DscInstrumento}" Width="200" IsReadOnly="True"/>
                            <data:DataGridTextColumn Header="Bem" Binding="{Binding DscBem}" Width="200" IsReadOnly="True"/>
                            <data:DataGridTextColumn Header="Natureza" Binding="{Binding DscNatureza}" Width="200" IsReadOnly="True"/>
                            <data:DataGridTextColumn Header="HE(%)" Binding="{Binding PercHE}" Width="90"  IsReadOnly="False"/>
                            <data:DataGridTextColumn Header="HV(%)" Binding="{Binding PercHV}" Width="90" IsReadOnly="False"/>
                            <data:DataGridTextColumn Header="LMM(%)" Binding="{Binding PercLMM}" Width="90" IsReadOnly="False"/>
                            <data:DataGridTemplateColumn Width="100" Header="Utilizar" IsReadOnly="True" >
                                <data:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox x:Name="cboUtilizar" SelectionChanged="cboUtilizar_SelectionChanged" />
                                    </DataTemplate>
                                </data:DataGridTemplateColumn.CellTemplate>
                            </data:DataGridTemplateColumn>
                            <data:DataGridTemplateColumn Width="175" Header="Transferência Incondicional" IsReadOnly="True" >
                                <data:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox x:Name="cboIncondicional" SelectionChanged="cboIncondicional_SelectionChanged" />
                                    </DataTemplate>
                                </data:DataGridTemplateColumn.CellTemplate>
                            </data:DataGridTemplateColumn>
                        </data:DataGrid.Columns>
                    </data:DataGrid>
                </Grid>
                
            </Grid>
        </Toolkit:BusyIndicator>
    </Grid>
</navigation:Page>